<?php

namespace App\Admin\Extensions;

use Dcat\Admin\Admin;
use Dcat\Admin\Grid\Displayers\AbstractDisplayer;

class FilterableDetailLink extends AbstractDisplayer
{
    public function display()
    {
        // 获取当前所有筛选条件
        $filters = request()->all();
        
        // 移除不必要的参数
        unset($filters['_token'], $filters['_pjax']);
        
        $url = admin_url("customer/{$this->value}")."?filters=".urlencode(json_encode($filters));
        
        return "<a href='{$url}'>{$this->value}</a>";
    }
}